package com.king.pattem.factory.factoryMethod;

import com.king.pattem.factory.factoryMethod.car.ICar;
import com.king.pattem.factory.factoryMethod.factory.ICarFactory;
import com.king.pattem.factory.factoryMethod.factory.impl.BenzFactory;
import com.king.pattem.factory.factoryMethod.factory.impl.BmwFactory;

/**
 *	工厂方法模式测试类 
 * @author taomk
 */
public class FactoryMethodTest {

	public static void main(String[] args) {
                
		ICar car;
		ICarFactory carFactory;
		
		try {
			
			System.out.println(" Factory Method Test ：");
			carFactory = new BenzFactory();
			car = carFactory.buildCar();
			car.drive(); 
			
			carFactory = new BmwFactory();
			car = carFactory.buildCar();
			car.drive(); 
		} catch (Exception e) {
			e.printStackTrace();
		} 
		
	}
}
